
<template>
  <div>
    <div id="editorElem" ref="editor" style="text-align:left"></div>
  </div>
</template>
<script>
import E from 'wangeditor'
export default {
  name: 'editor',
  data () {
    return {
      editor: '',
      editorContent: ''
    }
  },
  methods: {
    getContent () {
      return this.editorContent
    },
    setContent(html){
      this.editor.txt.html(html)
    }
  },
  mounted() {
    // var editor = new E('#editorElem')
    this.editor = new E(this.$refs.editor)
    this.editor.customConfig.uploadImgShowBase64 = true //图片以base64形式保存
    this.editor.customConfig.onchange = (html) => {
      this.editorContent = html
    }
    this.editor.customConfig.pasteTextHandle = (content) => { //支持粘贴
      return content
    }
    this.editor.create()
  }
}
</script>
<style scoped lang="scss">
</style>
